home *** CD-ROM | disk | FTP | other *** search
- class classes.shots.FireBall
- {
- var x;
- var y;
- var id;
- var clip;
- var xMov;
- var yMov;
- var Name = "fireBall";
- var power = 30;
- var c = 0;
- var yank = false;
- function FireBall(px, py, pid)
- {
- this.x = px;
- this.y = py;
- this.id = pid;
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("fireBall","fireBall" + this.id + "Clip",_root.d + 60000);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.clip.id = this.id;
- var _loc3_ = _root.getAngleRad2(this.x,this.y,_root[_root.char].x + 20,_root[_root.char].y + 20);
- this.xMov = Math.cos(_loc3_) * _root.randRange2(6,8);
- this.yMov = Math.sin(_loc3_) * _root.randRange2(6,8);
- this.xMov *= _root.dif.speed;
- this.yMov *= _root.dif.speed;
- }
- function hit()
- {
- this.yank = true;
- }
- function main()
- {
- this.xMov *= 1.02;
- this.yMov *= 1.02;
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
- this.yank = true;
- }
- if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
- {
- this.yank = true;
- }
- this.x += this.xMov;
- this.y += this.yMov;
- if(random(10) > 8)
- {
- _root.fxID = _root.fxID + 1;
- _root["fireBallTrail" + _root.fxID] = new classes.fx.FireBallTrail(this.x + 9,this.y + 9,_root.fxID);
- _root.addFX("fireBallTrail" + _root.fxID);
- }
- if(this.yank)
- {
- _root.removeEnemyShot("fireBall" + this.id);
- this.yank = false;
- }
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-